<template>
  <div>接口测试</div>
</template>
<script setup>
import axiosInstance from "@/utils/request.js"
import { ref, onMounted } from "vue"
import { GetSign, PostSign } from "@/api/sign.js"
onMounted(() => {
  getInit(`deviceAddr=${"863482068658372"}&timestamp=${"1715847946218"}`)
  // postInit(
  //   "7051836510030111099",
  //   `{"deviceAddr":${"868488076317997"},"params":[{"paramNo":${"upTime"},"paramValue":${"20"}}]}`
  // )
})
const getInit = async (deviceAddr, timestamp) => {
  let arr = await GetSign(deviceAddr, timestamp)
  console.log(arr.data.sign, "-------Git")
  const headers = {
    appId: "17392439385292",
    sign: arr.data.sign //解密获取
  }
  const params = {
    deviceAddr: "863482068658372", //问甲方
    timestamp: "1715847946218" //时间戳
  }
  console.log(headers)

  axiosInstance
    .get("/api/external/envi/getTerminalParamDataList", {
      headers: headers,
      params: params
    })
    .then((e) => {
      console.log(e)
    })
  getQingqiu("/api/external/envi/getDeviceList", headers, params)
}
const getQingqiu = async (Url, headers, params) => {
  const res = await axiosInstance.get(Url, {
    headers: headers,
    params: params
  })
  console.log(res)
}
// const postInit = async (deviceAddr, params) => {
//   // PostSign(deviceAddr, params)
//   let arr = await PostSign(deviceAddr, params)
//   console.log(arr.data.sign, "-------Post")
// }
</script>
<style scoped lang="less"></style>
